//
//  YHImageCell.m
//  LyhToolsTest
//
//  Created by LYH on 2018/10/26.
//  Copyright © 2018年 LYH.com. All rights reserved.
//

#import "YHImageCell.h"

@implementation YHImageCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self=[super initWithFrame:frame];
    if (self) {
        [self imageViewitem];
        [self delectBtn];
    }
    return self;
}
- (UIImageView *)imageViewitem
{
    if (!_imageViewitem ){
        _imageViewitem = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.contentView.width, self.contentView.height)];
        //图片填满，比例不变
        _imageViewitem.contentMode = UIViewContentModeScaleAspectFit;
        _imageViewitem.clipsToBounds = YES;//裁剪
        [self.contentView addSubview:_imageViewitem];
    }
    return _imageViewitem;
}
- (UIButton *)delectBtn
{
    if (!_delectBtn) {
        _delectBtn = [[UIButton alloc]init];
        _delectBtn.hidden = YES;
        _delectBtn.image = @"btn_del2";
        [self.contentView addSubview:_delectBtn];
        [_delectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(20, 20));
            make.left.equalTo(self.contentView.mas_right).offset(-10);
            make.bottom.equalTo(self.contentView.mas_top).offset(10);
        }];
    }
    return _delectBtn;
}
@end
